home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / OA0LJD (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  1.7 KB  |  34 lines

  1. package com.sun.java.swing.plaf.metal;
  2.  
  3. import com.sun.java.swing.Icon;
  4. import com.sun.java.swing.JLabel;
  5. import com.sun.java.swing.JList;
  6. import com.sun.java.swing.plaf.basic.BasicListCellRenderer;
  7. import java.awt.Component;
  8. import java.io.File;
  9.  
  10. class MetalFileChooserUI$DirectoryComboBoxRenderer extends BasicListCellRenderer {
  11.    // $FF: synthetic field
  12.    MetalFileChooserUI this$0;
  13.  
  14.    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
  15.       super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
  16.       File directory = (File)value;
  17.       if (directory == null) {
  18.          ((JLabel)this).setText("");
  19.          return this;
  20.       } else {
  21.          String fileName = this.this$0.getFileChooser().getName(directory);
  22.          ((JLabel)this).setText(fileName);
  23.          Icon icon = this.this$0.getFileChooser().getIcon(directory);
  24.          ((JLabel)this).setIcon(icon);
  25.          return this;
  26.       }
  27.    }
  28.  
  29.    // $FF: synthetic method
  30.    MetalFileChooserUI$DirectoryComboBoxRenderer(MetalFileChooserUI this$0) {
  31.       this.this$0 = this$0;
  32.    }
  33. }
  34.